From: chris@kneesaa.uk.xensource.com Date: Fri, 4 Aug 2006 09:28:51 +0000 (+0100) Subject: [qemu] Make sure disk writes really made it to disk before we report I/O X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15732^2~66 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=0a30ab00718eb664002924699d31a02ce1f27370;p=xen.git [qemu] Make sure disk writes really made it to disk before we report I/O completion to the guest domain. The DMA_MULTI_THREAD functionality from the qemu-dm IDE emulation should make the performance overhead of synchronous writes bearable, or at least comparable to native hardware. Signed-off-by: Rik van Riel --- diff --git a/tools/ioemu/block-bochs.c b/tools/ioemu/block-bochs.c index 62317aff38..d82c239281 100644 --- a/tools/ioemu/block-bochs.c +++ b/tools/ioemu/block-bochs.c @@ -91,7 +91,7 @@ static int bochs_open(BlockDriverState *bs, const char *filename) int fd, i; struct bochs_header bochs; - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); + fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC); if (fd < 0) { fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); if (fd < 0) diff --git a/tools/ioemu/block-cloop.c b/tools/ioemu/block-cloop.c index c617e1b64b..0f56685664 100644 --- a/tools/ioemu/block-cloop.c +++ b/tools/ioemu/block-cloop.c @@ -55,7 +55,7 @@ static int cloop_open(BlockDriverState *bs, const char *filename) BDRVCloopState *s = bs->opaque; uint32_t offsets_size,max_compressed_block_size=1,i; - s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); + s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE | O_SYNC); if (s->fd < 0) return -1; bs->read_only = 1; diff --git a/tools/ioemu/block-cow.c b/tools/ioemu/block-cow.c index eeeab7068b..6a42a46ef4 100644 --- a/tools/ioemu/block-cow.c +++ b/tools/ioemu/block-cow.c @@ -69,7 +69,7 @@ static int cow_open(BlockDriverState *bs, const char *filename) struct cow_header_v2 cow_header; int64_t size; - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); + fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC); if (fd < 0) { fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); if (fd < 0) diff --git a/tools/ioemu/block-qcow.c b/tools/ioemu/block-qcow.c index 34026a4f2c..b28fe58d72 100644 --- a/tools/ioemu/block-qcow.c +++ b/tools/ioemu/block-qcow.c @@ -95,7 +95,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename) int fd, len, i, shift; QCowHeader header; - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); + fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC); if (fd < 0) { fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); if (fd < 0) diff --git a/tools/ioemu/block-vmdk.c b/tools/ioemu/block-vmdk.c index fc87be353b..03bbb7a765 100644 --- a/tools/ioemu/block-vmdk.c +++ b/tools/ioemu/block-vmdk.c @@ -96,7 +96,7 @@ static int vmdk_open(BlockDriverState *bs, const char *filename) uint32_t magic; int l1_size; - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); + fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC); if (fd < 0) { fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); if (fd < 0) diff --git a/tools/ioemu/block.c b/tools/ioemu/block.c index 9c628f93bf..330d5c146d 100644 --- a/tools/ioemu/block.c +++ b/tools/ioemu/block.c @@ -677,7 +677,7 @@ static int raw_open(BlockDriverState *bs, const char *filename) int rv; #endif - fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE); + fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC); if (fd < 0) { fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE); if (fd < 0)